const express = require('express')
const mongose = require('mongoose')
mongose.connect('mongodb://127.0.0.1:27017/boke')
    .then(() => console.log('mongodb连接成功^-^...'))
    .catch((e) => console.log('mongodb连接失败@-@...', e))

const app = express()

//  挂载静态资源
app.use('/public', express.static("public"))

//  挂载【跨域解析器】
app.use(require('cors')())

//  挂载【body】解析器
app.use(express.json())

// 挂载【路由】解析器
app.use('/', require('./routes/index'))


app.listen(8090, () => {
    console.log('服务器启动成功,端口号8090');
})